/*
 *
 * @User: winter
 * @Date: 2020/4/17
 * @Time: 3:33 下午
 *
 */
'use strict';
const fs = require('fs');
const os = require('os');
const gulp = require('gulp');
const GulpSSH = require('gulp-ssh');
const userInfo = os.userInfo();

const config = {
    ssh: { // 正式
        host: 'webapi.fastonetech.com',
        port: 22,
        username: 'root',
        privateKey: fs.readFileSync(`${userInfo.homedir}/Desktop/key/fastone-demo.pem`)
    }
};

let gulpSSH = new GulpSSH({
    ignoreErrors: false,
    sshConfig: config.ssh
});

gulp.task('deploy', function () {
    return gulpSSH
        .shell(['cd /srv/docker/faston-landing-m', 'docker-compose  pull', 'docker-compose up --force-recreate -d'], {filePath: 'shell.log'})
        .pipe(gulp.dest('logs'))
});
